<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/taglibs.jsp"%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>系统管理</title>
<%@ include file="/common/util.jsp"%>



<script type="text/javascript">
$(document).ready(function(){
	for ( var i = 1; i < 12; i++) {
        $("#id" + i).removeClass("current");
    }
    $("#id8").addClass("current");

});
function jumpPage(pageIndex){   
	$("#pageElecEnergyForm").attr("action", "${cdnctx}/systemElecEnergy/pageElecEnergyList.shtml");
	$("#pageIndex").val(pageIndex);
	$("#pageElecEnergyForm").submit(); 
}
var obj = {
	addElecEnergy : function(){
		$("#pageElecEnergyForm").attr("action", "${cdnctx}/systemElecEnergy/addElecEnergyInit.shtml");
		$("#pageElecEnergyForm").submit(); 
	},
	updateElecEnergy : function(elecEnergyid){
		var sumbitForm =  $("<form  method='post'></form>");
		sumbitForm.attr("action","${cdnctx}/systemElecEnergy/updateElecEnergyInit.shtml");
        sumbitForm.append("<input type='hidden' name='elecEnergySearchEnity.powerCode' value='${elecEnergySearchEnity.powerCode}'>");
        sumbitForm.append("<input type='hidden' name='pageIndex' value='${pageIndex}'>");
        sumbitForm.append("<input type='hidden' name='elecEnergyid' value='"+elecEnergyid+"'>");
	    sumbitForm.appendTo(document.body).submit();
	},
	searchResert : function(){
		$("#searchPowerCode").val("");
		$("#searchPowerType").val("-99");
	},
	deleteElecEnergy : function(elecEnergyid,modifyStamp){
		var param = {"id":""+elecEnergyid,"modifyStamp":modifyStamp};
			$.ajax({
				type : "POST",
				contentType : "application/json",
				url : "versionElecEnergyVali.shtml",
				data : JSON.stringify(param),
				dataType : "json",
				success: function(data){
					if(data.versionFlag == true){
						dialog_confirmled("确定删除吗？",function(){
							var sumbitForm =  $("<form  method='post'></form>");
							sumbitForm.attr("action","${cdnctx}/systemElecEnergy/deleteElecEnergy.shtml");
					        sumbitForm.append("<input type='hidden' name='elecEnergySearchEnity.powerCode' value='${elecEnergySearchEnity.powerCode}'>");
					        sumbitForm.append("<input type='hidden' name='pageIndex' value='${pageIndex}'>");
					        sumbitForm.append("<input type='hidden' name='elecEnergyEntity.id' value='"+elecEnergyid+"'>");
						    sumbitForm.appendTo(document.body).submit();
						});
					}else{
						dialog_alert("这条数据已经被他人修改！");
					}
				},
				error: function(){
					dialog_alert("error");
				}
			});
	}
}
</script>
</head>
<body class="main">
	<div class="-frame -style -luster" id="css_container">
		<!--首页框架页眉部分↓-->
		<%@ include file="/WEB-INF/pages/inc/header.jsp"%>
		<!--首页框架页眉部分↑-->

		<div class="content">

			<!-- Left导航菜单◎开始 -->
			<%@ include file="/WEB-INF/pages/inc/leftmenu.jsp"%>
			<!-- Left导航菜单◎结束 -->

			<div class="main-mid">
				<div class="pos"><img src="${cdnctx}/src/index/img/index.png"><a href="<%--${cdnctx}/system/systemMenu.shtml--%>">系统管理  ></a><a href="${cdnctx}/systemElecEnergy/elecEnergyList.shtml">度电能耗管理</a></div>
				<div class="css_contentDiv">
					<form id="searchElecEnergyForm" action="${cdnctx}/systemElecEnergy/searchElecEnergyList.shtml" method="post">
						<div class="searchArea b-border-radius" style="padding:10px;">
							<label class="search_text">能耗番号：</label> 
							<input id="searchPowerCode" name="elecEnergySearchEnity.powerCode" type="text" class="search_input"
								value='${elecEnergySearchEnity.powerCode== -99 ? "" : elecEnergySearchEnity.powerCode}' />
							<label class="search_text">能耗类型：</label> 
							<select id="searchPowerType" name="elecEnergySearchEnity.powerType" 
							    class="search_select" />
							    <option value="-99">--选择--</option>
							    <option value="1" <c:if test="${1 == elecEnergySearchEnity.powerType}">selected</c:if>>标准煤</option>
		                        <option value="2" <c:if test="${2 == elecEnergySearchEnity.powerType}">selected</c:if>>CO₂</option>
		                        <option value="3" <c:if test="${3 == elecEnergySearchEnity.powerType}">selected</c:if>>碳</option>
		                        <option value="4" <c:if test="${4 == elecEnergySearchEnity.powerType}">selected</c:if>>SO₂</option>
							</select>	
							<input type="submit" class="search_btn" value="查&nbsp;询" />
							<input type="button" class="reset_btn" value="重&nbsp;置" onclick="obj.searchResert()"/>
							<input type="button" class="add_btn" value="新&nbsp;增" onclick="obj.addElecEnergy()"/>
						</div>
					</form>
					<form id="pageElecEnergyForm"  method="post">
					    <input type="hidden" id="pagePowerCode" name="elecEnergySearchEnity.powerCode" value="${elecEnergySearchEnity.powerCode}"/>
					    <input type="hidden" id="pageIndex" name="pageIndex" value="${pageIndex}"/>
					</form>
					<div class="divTable">
						<div class="detailDiv">
							<table width="100%" border="0" cellspacing="0" cellpadding="0"
								class="list_table"  >
								<thead>
									<tr>
										<td>能耗番号</td>
										<td>能耗类型</td>
										<td>灯具类型</td>
										<td>能耗标准(g)</td>
										<td>修改者</td>
										<td>修改时间</td>
										<td>备注</td>
										<td>操作</td>
									</tr>
								</thead>
								<c:if test="${empty(list) }">
									<tr class="even" align="center" style="color:red">
										<td colspan="9" class="no-data" style="height: 300px;"></td>
									</tr>
								</c:if>
								<c:if test="${not empty(list) }">
								<c:forEach items="${list}" var="entity" varStatus="status">
									<tr>
										
										<td>${entity.powerCode}</td>
										<td>${entity.powerName}</td>
										<td>${entity.lightName}</td>
										<td>${entity.powerStandardValue}</td>
										<td>${entity.modifyBy}</td>
										<td>${entity.modifyDate.toString().substring(0,entity.modifyDate.toString().length()-2)}</td>
										<td>${entity.memo}</td>
										<td>
											<input id='newbutton' type='button' class='list_update_btn' onclick='obj.updateElecEnergy(${entity.id})' value='修改' />
											<input id='newbutton' type='button' class='list_delete_btn' onclick='obj.deleteElecEnergy(${entity.id},"${entity.modifyStamp}")' value='删除' />
										</td>
									</tr>
								</c:forEach>
								</c:if>
							</table>
						</div>
						<c:if test="${not empty(list) }">
						<div id="pageInfo" class="pageJump">
							<script type="text/javascript">
				            	pagination.getPaginationHtml('JavaScript:jumpPage({0})',${pageIndex},${pageCount},'pageInfo');
				        	</script>
				        	<c:if test="${!empty(list) }">
				        		共有${dataCount}条数据
				        	</c:if>
						</div>
						</c:if>
						
					</div>
				</div>
			</div>

		</div>

		<!--首页框架页尾部分↓-->
		<%@ include file="/WEB-INF/pages/inc/footer.jsp"%>
		<!--首页框架页尾部分↑-->
	</div>
</body>
</html>